<template>
  <div class="modify-dialog">
    <slot> </slot>
    <el-dialog v-bind="dialogOpts" :visible.sync="dialogVisible">
      <Form v-bind="formOpts" v-on="formEvent">
        <template #formSuf>
          <el-form-item label="转化图" style="width: 100%">
            <Uploader v-model="fileList" />
          </el-form-item>
          <el-form-item label="仓储架图" style="width: 100%">
            <Uploader v-model="fileList2" />
          </el-form-item>
        </template>
        <template #formBtn>
          <div class="dialog-footer">
            <el-button @click="dialogVisible = false">取 消</el-button>
            <el-button type="primary" @click="onConfirm"> 确 定 </el-button>
          </div>
        </template>
      </Form>
    </el-dialog>
  </div>
</template>

<script>
import modifyMixins from "@/mixins/modifyMixins.vue";

export default {
  mixins: [modifyMixins],
  data() {
    return {
      labelPosition: "left",
      fileList: [],
      fileList2: [],
      form: {},
    };
  },
  computed: {
    title() {
      return "CAD图纸上传";
    },
  },
  methods: {
    onSubmit(form) {
      const { modify, row, fileList, fileList2 } = this;
      const { id } = row;
      form.id = id;
      form.cadImg = fileList[0];
      form.storageImg = fileList2[0] || "";
      this.$api["newCadParse"](form).then(this.submitDoneMsg);
    },
  },
};
</script>

<style lang="less" scoped></style>
